/**
 * 产品相关的请求
 */
import Urls from '../ApiUrls';
import ApiBase from './ApiBase';

class ApiProduct {

  getProductList(parms) {
    return ApiBase.send(Urls.URL_PRODUCT_LIST, parms);
  }

  findProducts(params) {
    return ApiBase.send(Urls.URL_FIND_PRODUCTS, params);
  }

  getProductById(parms) {
    return ApiBase.send(Urls.URL_GET_PRODUCT_BY_ID, parms);
  }
  //保存修改
  saveEditProduct(parms) {
    return ApiBase.send(Urls.URL_EDIT, parms);
  }
  //保存新增
  saveAddProduct(params) {
    return ApiBase.send(Urls.URL_ADD, params);
  }
  changeProductState(parms) {
    return ApiBase.send(Urls.URL_CHANGE_PRODUCT_STATE, parms);
  }

  productToRecycle(parms) {
    return ApiBase.send(Urls.URL_PRODUCT_TO_RECYCLE, parms);
  }

  /**
   *
   * @param parms  list 0:置顶  1:取消
   * @returns {*|AxiosPromise}
   */
  productTop(parms) {
    return ApiBase.send(Urls.URL_PRODUCT_TOP, parms);
  }

  batchUpdateState(parms) {
    return ApiBase.send(Urls.URL_BATCH_UPDATE_STATE, parms);
  }

  batchToRecycle(parms) {
    return ApiBase.send(Urls.URL_BATCH_TO_RECYCLE, parms);
  }

  getCommonData(params) {
    return ApiBase.send(Urls.URL_COMMON_DATA, params);
  }

  addEditProductColor(parms) {
    return ApiBase.send(Urls.URL_PRODUCT_COLOR_ADD_EDIT, parms);
  }

  changeProductColorState(parms) {
    return ApiBase.send(Urls.URL_PRODUCT_COLOR_STATE, parms);
  }

  recycleProductColorState(parms) {
    return ApiBase.send(Urls.URL_PRODUCT_COLOR_RECYCLE, parms);
  }

  listSysSizes(params) {
    return ApiBase.send(Urls.URL_SYS_SIZE_LIST, params);
  }

  saveSysSize(params) {
    return ApiBase.send(Urls.URL_SAVE_SYS_SIZE, params);
  }

  deleteSysSize(params) {
    return ApiBase.send(Urls.URL_DEL_SYS_SIZE, params);
  }

  getProductClassifications(params) {

    return ApiBase.send(Urls.URL_PRODUCT_CLASSIFICATION_LIST, params);
  }

  batchInsertProductClassification(params) {
    return ApiBase.send(Urls.URL_INSERT_PRODUCT_CLASSIFICATION, params);
  }

  batchDeleteProductClassification(params) {
    return ApiBase.send(Urls.URL_DEL_PRODUCT_CLASSIFICATION, params);
  }

  getProductSizes(params) {
    return ApiBase.send(Urls.URL_GET_PRODUCT_SIZES, params);
  }

  getProductColorsByProductId(params) {
    return ApiBase.send(Urls.URL_GET_COLORS_BY_PRODUCTID, params);
  }

  getProductColorById(params) {
    return ApiBase.send(Urls.URL_GET_COLOR_BY_ID, params);
  }

  getTabs() {
    return ApiBase.send(Urls.URL_GET_TABS, null);
  }

  addEditTab(params) {
    return ApiBase.send(Urls.URL_SAVE_TAB, params);
  }

  deleteTab(params) {
    return ApiBase.send(Urls.URL_DELETE_TAB, params);
  }

  getProductTabs(params) {

    return ApiBase.send(Urls.URL_PRODUCT_TAB_LIST, params);
  }

  batchEditProductTab(params) {
    return ApiBase.send(Urls.URL_EDIT_PRODUCT_TAB, params);
  }

  selectProducts(params) {
    return ApiBase.send(Urls.URL_SELECT_PRODUCT, params);
  }
  getStockEmpty(params){
    return ApiBase.send(Urls.URL_STOCK_EMPTY, params);
  }
  getUploadUrl(){
    return Urls.URL_UPLOAD_TO_OSS;
  }
  getSizeUploadUrl(){
    return Urls.URL_UPLOAD_SIZE;
  }
  modifyCode(params){
    return ApiBase.send(Urls.URL_MODIFY_PRODUCT_CODE, params);
  }
  recycleBin(parms) {
    return ApiBase.send(Urls.URL_PRODUCT_RECYCLE, parms);
  }
  findBackProduct(parms) {
    return ApiBase.send(Urls.URL_PRODUCT_FIND_BACK, parms);
  }
  exportProductToExcel(params, timeout){
    return ApiBase.send(Urls.URL_EXPORT_PRODUCT, params, timeout);
  }
  realDeleteProduct(parms) {
    return ApiBase.send(Urls.URL_REAL_DELETE_PRODUCT, parms);
  }
  batchSequenceProduct(parms) {
    return ApiBase.send(Urls.URL_BATCH_SEQUENCE_PRODUCT, parms);
  }
  batchSequenceColor(parms) {
    return ApiBase.send(Urls.URL_BATCH_SEQUENCE_COLOR, parms);
  }
  getProductOrders(parms) {
    return ApiBase.send(Urls.URL_LIST_PRODUCT_ORDER, parms);
  }
  getProductSupplys(params) {
    return ApiBase.send(Urls.URL_GET_PRODUCT_SUPPLYS, params);
  }
  deleteProductSupply(params) {
    return ApiBase.send(Urls.URL_DELETE_PRODUCT_SUPPLY, params);
  }
  saveProductSupply(params) {
    return ApiBase.send(Urls.URL_SAVE_PRODUCT_SUPPLY, params);
  }
  addProductByCrawler(params) {
    return ApiBase.send(Urls.URL_ADD_PRODUCT_BY_CRAWLER, params);
  }
  getProductOverstock(params) {
    return ApiBase.send(Urls.URL_GET_PRODUCT_OVERSTOCK, params);
  }
  saveProductOverstock(params) {
    return ApiBase.send(Urls.URL_SAVE_PRODUCT_OVERSTOCK, params);
  }
  exportExcelForExhibit(params, timeout){
    return ApiBase.send(Urls.URL_EXPORT_PRODUCT_FOR_EXHIBIT, params, timeout);
  }

  updateCloudIndex(){
    return ApiBase.send(Urls.URL_EXPORT_UPDATE_CLOUD_INDEX, null);
  }

  findManageTabProducts(params) {
    return ApiBase.send(Urls.URL_FIND_MANAGE_TAB_PRODUCTS, params);
  }

  findImportedProducts(params) {
    return ApiBase.send(Urls.URL_PRODUCT_FIND_IMPORTED, params)
  }

  updateClassifications(params) {
    return ApiBase.send(Urls.URL_PRODUCT_UPDATE_CLASSIFICATIONS, params);
  }

  queryDeletableProducts(params) {
    return ApiBase.send(Urls.URL_QUERY_DELETABLE_PRODUCTS, params);
  }

  safeDelete(params) {
    return ApiBase.send(Urls.URL_SAFE_DELETE_PRODUCTS, params);
  }
}
export  default  ApiProduct
